

unsigned char ch;
unsigned int adc_rd;
char *text;
long tlong;

void main() {
  INTCON = 0;                              // disable all interrupts
  Lcd_Config(&PORTB, 4, 5, 6, 3, 2, 1, 0); // Lcd_Init_EP5, see Autocomplete
  LCD_Cmd(LCD_CURSOR_OFF);                 // send command to LCD (cursor off)
  LCD_Cmd(LCD_CLEAR);                      // send command  to LCD (clear LCD)





  text = "ING4 SE ";               // assign text to string
  LCD_Out(1,1,text);                       // print string a on LCD, 1st row, 1st column
  text = "LCD test  ";                    // assign text to string
  LCD_Out(2,1,text);                       // print string a on LCD, 2nd row, 1st column

  ADCON1     = 0x82;                       // configure VDD as Vref, and analog channels
  TRISA      = 0xFF;                       // designate PORTA as input
  Delay_ms(2000);
  text  = "Mesure:";                      // assign text to string
  while (1) {
    adc_rd  = ADC_read(2);                 // get ADC value from 2nd channel
   /* LCD_Out(2,1,text);                     // print string a on LCD, 2nd row, 1st column
     */
    tlong = (long)adc_rd *5000;
    LongToStr(tlong, text);
    LCD_Cmd(LCD_CLEAR);
LCD_Out(1,1,text);          // covert adc reading to milivolts
                                              // 0..1023 -> 0-5000mV
     tlong = tlong / 1023;

LongToStr(tlong, text);
LCD_Out(2,1,text);

    Delay_ms(1);
  }
}

